package com.applozic.mobicomkit.uiwidgets.conversation.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

import com.applozic.mobicomkit.api.conversation.Message;
import com.lottery.ruok.lottrey.R;
import com.lottery.ruok.lottrey.common.Common;
import com.lottery.ruok.lottrey.ui.component.BaseRelativeLayout;

import butterknife.BindView;

public class ApplozicChannelCustomMessageView extends BaseRelativeLayout {
    @BindView(R.id.channel_message)
    TextView channelMessageTextView;

    public ApplozicChannelCustomMessageView(Context context) {
        super(context);
    }

    public ApplozicChannelCustomMessageView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public ApplozicChannelCustomMessageView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void init(Context context, AttributeSet attrs, int defStyleAttr) {

    }

    @Override
    protected void initView(Context context) {
        setContentView(R.layout.applozic_channel_custom_message_layout);
    }

    @Override
    protected void load(Context context) {

    }

    public void setData(Message message) {
        channelMessageTextView.setText(message.getMessage().replace("created", "创建了")
                .replace("group", "群")
                .replace(Common.CHAT_ACCOUNT, "管理员")
                .replace("removed", "移除了")
                .replace("added", "添加了")
                .replace("Group name changed to", "群名被改为"));
    }
}
